/*
 * 文件名：IntegralCategoryServiceImpl.java
 * 版权：Copyright by www.huawei.com
 * 描述：
 * 修改人：Administrator
 * 修改时间：2016年4月14日
 * 跟踪单号：
 * 修改单号：
 * 修改内容：
 */

package com.zcsy.manage.service.mall.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zcsy.manage.model.mall.IntegralCategory;
import com.zcsy.manage.persistence.mall.IntegralCategoryDao;
import com.zcsy.manage.service.mall.IIntegralCategoryService;

/**
 * @Title: IntegralCategoryServiceImpl.java
 * @Package： com.zcsy.manage.service.mall.impl 
 * @Description: 积分分类管理service层接口实现类
 * @author liuying 1075817474@qq.com
 * @Copyright: 2015 武汉中财数元信息技术有限公司 All rights reserved.
 * @date 2016年4月14日
 * @version 1.0
 * @see JDK1.7.0_75
 * @since
 */
@Service
public class IntegralCategoryServiceImpl implements IIntegralCategoryService{

	@Autowired
	private IntegralCategoryDao integralCategoryDao;
	
	/* (non-Javadoc)
	 * @see com.zcsy.manage.service.mall.IIntegralCategoryService#insert(com.zcsy.manage.model.mall.IntegralCategory)
	 */
	@Override
	public int insert(IntegralCategory integralCategory) {
		return integralCategoryDao.insert(integralCategory);
	}

	/* (non-Javadoc)
	 * @see com.zcsy.manage.service.mall.IIntegralCategoryService#update(com.zcsy.manage.model.mall.IntegralCategory)
	 */
	@Override
	public int update(IntegralCategory integralCategory) {
		IntegralCategory oldCategory = integralCategoryDao.selectByPrimaryKey(integralCategory.getId());
		
		oldCategory.setName(integralCategory.getName());
		oldCategory.setMin(integralCategory.getMin());
		oldCategory.setMax(integralCategory.getMax());
		oldCategory.setUserAccount(integralCategory.getUserAccount());
		oldCategory.setLogo(integralCategory.getLogo());
		oldCategory.setRecordTime(integralCategory.getRecordTime());
		
		return integralCategoryDao.updateByPrimaryKey(oldCategory);
	}

	/* (non-Javadoc)
	 * @see com.zcsy.manage.service.mall.IIntegralCategoryService#delete(java.lang.String)
	 */
	@Override
	public int delete(String id) {
		return integralCategoryDao.deleteByPrimaryKey(id);
	}

	/* (non-Javadoc)
	 * @see com.zcsy.manage.service.mall.IIntegralCategoryService#selectByPrimaryKey(java.lang.String)
	 */
	@Override
	public IntegralCategory selectByPrimaryKey(String id) {
		return integralCategoryDao.selectByPrimaryKey(id);
	}

	/* (non-Javadoc)
	 * @see com.zcsy.manage.service.mall.IIntegralCategoryService#selectByKeyword(com.zcsy.manage.model.mall.IntegralCategory)
	 */
	@Override
	public List<IntegralCategory> selectByKeyword(
			IntegralCategory integralCategory) {
		return integralCategoryDao.selectByKeyword(integralCategory);
	}
	
	@Override
	public List<IntegralCategory> selectAll() {
		return integralCategoryDao.selectAll();
	}

}
